<#import "../macro/components.ftl" as components/>
<#include "../macro/layout_default.ftl"/>

<@body>
<#--<script src="/misc/app/js/lgs_cust.js"></script>-->
<script>
    $(function () {
        $(".record").click(function(){
            var branchId = $(this).data("cust-id");
            window.location.href="/cust/scanList?branchId="+branchId;
        })
    })
</script>
</@body>

<@layout_default>
<div class="box">
    <div class="box-header with-border">
    <#--<span class="pull-right text-muted">共 ${custList.resultTotal} 条记录</span>-->
        <form class="form-inline" action="/cust/list">
            <div class="input-group">
                <div class="input-group-addon">进货网点名称</div>
                <input type="text" class="form-control" style="width: 260px" name="keyword" value="${keyword!}"/>
            </div>

            <div class="input-group">
                <div class="input-group-addon">编码</div>
                <input type="text" class="form-control" style="width: 260px" name="custCode" value="${custCode!}"/>
            </div>

            <div class="input-group">
                <div class="input-group-addon">手机号</div>
                <input type="text" class="form-control" style="width: 260px" name="mobile" value="${mobile!}"/>
            </div>


            <button type="submit" class="btn btn-warning"><i class="fa fa-search"></i> 搜索</button>
        </form>
    </div>

    <div class="box-body">
        <table class="table table-striped table-hover">
            <tr>
                <th>ID</th>
                <th>进货网点</th>
                <th>编码</th>
                <th>手机号码</th>
                <th>负责人</th>
                <th>区域</th>
                <th>地址</th>
                <th>操作</th>
            </tr>
            <#if (custList.result?size > 0)>
                <#list custList.result as item>
                    <tr>
                        <td>${item.id!}</td>
                        <td>${item.custName!}</td>
                        <td>${item.custCode!}</td>
                        <td>${item.mobile!}</td>
                        <td>${item.owner!}</td>
                        <td>${item.areaName!}</td>
                        <td>${item.addr!}</td>
                        <td>
                            <#--<button type="button" class="btn btn-default btn-xs" data-toggle="modal" data-target="#md_edit_cust" data-cust-id="${item.id!}">详情</button>-->
                            <button type="button" class="btn btn-default btn-xs record"  data-cust-id="${item.id!}">进货记录</button>
                            <#--<a href="/cust/scanList?branchId=${item.id!}">进货记录</a>-->
                        </td>
                    </tr>
                </#list>
            <#else>
                <tr>
                    <td class="text-center text-muted" colspan="6"><i class="fa fa-info-circle"></i> 没有记录</td>
                </tr>
            </#if>
        </table>
    </div>
    <!-- /.box-body -->
    <div class="box-footer text-center">
        <@components.pagination "/cust/list?keyword=${keyword!}&custCode=${custCode!}&mobile=${mobile!}&page=$page",custList.page,custList.pageTotal/>
    </div>
</div>


</@layout_default>